home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
parallax
/
maspar_d.tar
/
maspar_dec
/
pz2mpls.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-14
|
13KB
|
407 lines
/**********************************************************************
*** ***
*** PARZ-Library for MasPar MPL ***
*** ***
*** (c) by University Stuttgart, Germany, 1991 ***
*** ***
*** Don't edit this file !!! ***
*** ***
*********************************************************************/
#ifndef PZ2MPLSH
#define PZ2MPLSH
#ifndef IN_EMIT
#ifndef GRAPHC
#include <stdio.h>
#include <math.h>
#include <mpl.h>
#include <time.h>
#include <maspar/mp_time.h>
#include <maspar/mp_libc.h>
#endif
#endif
/********************* DEFINES **************************************/
#define SINGLE 0
#define DOUBLE 1
#if 0
#define PRECISION DOUBLE
#endif
typedef long INT;
typedef unsigned char CHAR;
#if PRECISION == DOUBLE
typedef double REAL;
#else
typedef float REAL;
#endif
typedef long BOOL;
typedef union {
INT i;
CHAR c;
BOOL b;
REAL r;
} MemItem;
#ifndef IN_EMIT
#ifndef GRAPHC
#define PINT plural INT
#define PCHAR plural CHAR
#define PREAL plural REAL
#define PBOOL plural BOOL
#define isActive() (actPE [i])
#define Eval(a) callIt|=(int)globalor((plural int)(activePE[i]=(activePE[i]&126)|(isActive()?(a):0))&(plural char)1);\
actPE[i]=((plural short)activePE[i])&(plural short)1
#define ForAllPE for(i=0;i<PEMAX;i++) if (((plural int) InitialActSet [i]) & (plural int) 1)
#define ForAllActivePE for(i=0;i<PEMAX;i++) if (isActive())
#define NO_REDUCE 0
#define MIN_REDUCE 1
#define MAX_REDUCE 2
#define SUM_REDUCE 3
#define MUL_REDUCE 4
#define AND_REDUCE 5
#define OR_REDUCE 6
#define FIRST_REDUCE 7
#define LAST_REDUCE 8
#define OWN_REDUCE 9
/********************* TYPES *****************************************/
typedef plural union {
INT i;
CHAR c;
BOOL b;
REAL r;
} PMemItem;
typedef PMemItem *plural PMemPtr;
typedef struct {
MemItem *scalar;
PMemItem *vector;
int vecSize;
int indIndex;
struct timeval startTime;
} ACTRECORD;
/************************** VARIABLES *******************************/
/*** predeclared variables ***/
extern MemItem _MAXTRANS;
extern MemItem _ACTTRANS;
extern MemItem _SRESULT;
extern MemItem _DONE;
extern MemItem _TERMCH;
extern PMemItem *_VRESULT;
extern PMemItem *_ID;
/*** input / output ***/
extern FILE *in, *out;
/*** maintenance ***/
extern plural char *activePE, *InitialActSet;
extern plural short *actPE;
extern MemItem *SDisp [];
extern PMemItem *VDisp [];
extern MemItem **SIndDisp;
extern PMemPtr *plural VIndDisp;
extern int IndIndex, *IndSizeDisp;
extern INT outPortTmp, inPortTmp;
extern int callIt, indent;
extern PMemItem *vTmp, *vTmp2;
extern MemItem tmpItem, tmpItem2;
extern struct timezone timeZone;
extern char *cntrlStr;
/*************************** FUNCTIONS ******************************/
/*** maintenance ***/
extern void InitDisplay (), ResetDisplay (int level, ACTRECORD *buf);
extern void DPUStartTime (struct timeval *startTime),
DPUPrintTime (struct timeval *startTime, char *procName);
extern void SetAct (int start, int ende, char *str);
extern void SetSet (MemItem *arrayStart,
int start,
int ende,
char *str),
VSetSet (PMemItem *plural arrayStart,
int start,
int ende,
char *str);
extern void SetPos (int *startPtr,
int startValue,
int length);
extern INT NewSMem (int size);
extern plural INT NewVMem (int size);
extern MemItem *SRef (INT refIndex);
extern PMemItem *plural VRef (plural INT refIndex);
extern void INIT (int argc,
char *argv [],
int NumOfPEs,
int NumOfPorts,
int globalVecSize,
MemItem *scaAdr,
PMemItem *vecAdr,
int hasNew,
char *progName,
int xnetUse,
int xDim,
int yDim,
int Recording,
int UsesGraphics),
EXIT (int value),
Indent (int num);
extern int STATUS (BOOL *to);
/*** stack ***/
extern void PUSHSi (INT val), PUSHSb (BOOL val), PUSHSr (REAL val), PUSHSc (CHAR val);
extern void PUSHVi (int indx, plural INT val),
PUSHVr (int indx, plural REAL val),
PUSHVb (int indx, plural INT val),
PUSHVc (int indx, plural CHAR val);
extern INT POPSi ();
extern REAL POPSr ();
extern BOOL POPSb ();
extern CHAR POPSc ();
extern PINT POPVi (int indx);
extern PREAL POPVr (int indx);
extern PBOOL POPVb (int indx);
extern PCHAR POPVc (int indx);
/*** control statements ***/
extern void PushActSet_ (), _PopActSet ();
/*** math ***/
extern INT RandomI ();
extern CHAR RandomC ();
extern INT RandomB ();
extern REAL RandomR ();
extern plural INT VRandomI ();
extern plural CHAR VRandomC ();
extern plural INT VRandomB ();
extern plural REAL VRandomR ();
extern INT _MOD (INT lhs, INT rhs);
extern INT _IPOWER (INT base, INT exp);
extern REAL _RIPOWER (REAL rb, INT ie), _RRPOWER (REAL base, REAL exp);
extern plural INT _VMOD (plural INT lhs, plural INT rhs),
Vabs (plural INT val);
extern plural INT _VIPOWER (plural INT base, plural INT exp);
extern plural REAL _VRIPOWER (plural REAL rb, plural INT ie),
_VRRPOWER (plural REAL base, plural REAL exp);
/*** input / output ***/
extern void OpenInput (char *name), OpenInputChars (MemItem *name),
CloseInput ();
extern void OpenOutput (char *name), OpenOutputChars (MemItem *name),
CloseOutput ();
extern void InBool (BOOL *var), InChars (CHAR *var, INT maxLen),
OutChars (CHAR *buf, INT min);
extern void VOutBool (plural BOOL buf);
extern void VInChars (plural CHAR *plural var, INT maxLen),
VOutChars (plural CHAR *buf, INT min);
extern plural INT VInInt ();
extern plural REAL VInReal ();
extern plural BOOL VInBool ();
/*** strings ***/
extern void _StrCopy (CHAR *to, char *str);
extern INT _StrCmpCon (CHAR *str1, char *str2);
extern INT _StrCmp (CHAR *str1, CHAR *str2);
extern plural INT _VStrCmpCon (plural CHAR *str1, char *str2);
extern plural INT _VStrCmp (plural CHAR *str1, plural CHAR *str2);
/*** reduction ***/
/*** reduce variable ***/
extern void GenProp_ (INT outPort,
INT inPort,
int reduceCode,
void (*reduceLabel) (),
int OutAll,
int InAll),
_GenProp ();
extern void GenPropI (int indx,
plural INT *to,
plural INT from),
GenPropR (int indx,
plural REAL *to,
plural REAL from),
GenPropC (int indx,
plural CHAR *to,
plural CHAR from),
GenPropB (int indx,
plural BOOL *to,
plural BOOL from);
extern void RedSumI (plural INT var), RedMulI (plural INT var);
extern void RedSumR (plural REAL var), RedMulR (plural REAL var);
extern void RedMaxI (plural INT var), RedMinI (plural INT var);
extern void RedMaxR (plural REAL var), RedMinR (plural REAL var);
extern void RedMaxC (plural CHAR var), RedMinC (plural CHAR var);
extern void RedMaxB (plural BOOL var), RedMinB (plural BOOL var);
extern void RedAndB (plural BOOL var), RedOrB (plural BOOL var);
extern void RedFirstI (plural INT var), RedLastI (plural INT var);
extern void RedFirstR (plural REAL var), RedLastR (plural REAL var);
extern void RedFirstC (plural CHAR var), RedLastC (plural CHAR var);
extern void RedFirstB (plural BOOL var), RedLastB (plural BOOL var);
extern void Red_ ();
extern INT _RedI ();
extern REAL _RedR ();
extern CHAR _RedC ();
extern BOOL _RedB ();
extern void OwnRedI (int indx, plural INT val),
OwnRedR ( int indx, plural REAL val);
extern void OwnRedC ( int indx, plural CHAR val),
OwnRedB ( int indx, plural BOOL val);
extern void OwnRed ();
extern INT _OwnRedI (void (*reduceLabel) ());
extern REAL _OwnRedR (void (*reduceLabel) ());
extern CHAR _OwnRedC (void (*reduceLabel) ());
extern BOOL _OwnRedB (void (*reduceLabel) ());
/*** propagate reduce ***/
extern void PRedSumI (PMemItem *source,
plural INT **target),
PRedMulI (PMemItem *source,
plural INT **target);
extern void PRedSumR (PMemItem *source,
plural REAL **target),
PRedMulR (PMemItem *source,
plural REAL **target);
extern void PRedMaxI (PMemItem *source,
plural INT **target),
PRedMinI (PMemItem *source, plural INT **target);
extern void PRedMaxR (PMemItem *source,
plural REAL **target), PRedMinR (PMemItem *source,
plural REAL **target);
extern void PRedMaxC (PMemItem *source,
plural CHAR **target), PRedMinC (PMemItem *source,
plural CHAR **target);
extern void PRedMaxB (PMemItem *source,
plural INT **target), PRedMinB (PMemItem *source,
plural INT **target);
extern void PRedAndB (PMemItem *source,
plural INT **target), PRedOrB (PMemItem *source,
plural INT **target);
extern void PRedFirstI (PMemItem *source,
plural INT **target), PRedLastI (PMemItem *source,
plural INT **target);
extern void PRedFirstR (PMemItem *source,
plural REAL **target), PRedLastR (PMemItem *source,
plural REAL **target);
extern void PRedFirstC (PMemItem *source,
plural CHAR **target), PRedLastC (PMemItem *source,
plural CHAR **target);
extern void PRedFirstB (PMemItem *source,
plural INT **target), PRedLastB (PMemItem *source,
plural INT **target);
/*** data transfer ***/
extern void Connect_ (INT fromPort, INT toPort), Connect (int indx,
plural INT toPE);
extern void Biconnect_ (INT fromPort, INT toPort), Biconnect (int indx, plural INT toPE);
extern void Disconnect (INT fromPort), DisconnectAll ();
extern void ConnectIn_ (INT inPort), _ConnectIn ();
extern void ConnectInOut_ (INT inPort, INT outPort), _ConnectInOut ();
extern plural BOOL ConnectedIn (int indx), ConnectedInOut (int indx);
extern plural BOOL ConnectedOut (int indx, INT outPort), ConnectedOutIn (int indx,
INT outPort,
INT inPort);
extern void _LOAD (PMemItem *plural to,
MemItem *from,
int size),
_STORE (MemItem *to,
PMemItem *plural from,
int size),
_LOAD_PE (int pe,
PMemItem *plural to,
MemItem *from,
int size),
_STORE_PE (int pe,
PMemItem *plural to,
MemItem *from,
int size);
extern void _MOVE_VS (PMemItem *plural to,
MemItem *from,
int size),
_MOVE_VV (PMemItem *plural to,
PMemItem *plural from,
plural int size);
extern plural BOOL EQUAL_VS (PMemItem *plural vec,
MemItem *sca,
int amount);
/*** recording ***/
extern void EmitRecording (char statementTyp);
extern void IncStatCounter ();
/** graphics **/
#endif /* GRAPHC */
typedef struct colrec { MemItem r, g, b; } COLREC;
extern int acu_init_x (), acu_OpenW ();
extern int acu_CloseW (), acu_SelectW ();
extern int acu_WSize (), acu_SetColor (), acu_VSetColor ();
extern int acu_SetPixel (), acu_VSetPixel (), acu_DrawChar ();
extern int acu_GetPixel (), acu_MoveTo (), acu_LineTo ();
extern int acu_DrawString (), acu_DrawInt (), acu_DrawBool ();
extern int acu_DrawReal (), acu_DrawFixPt (), acu_DrawImage ();
#endif /* IN_EMIT */
#endif /* PZ2MPLH */
/*** End of pz2mpl.h ***/